package com.green.dao.manage.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.green.dao.impl.BaseDaoImpl;
import com.green.dao.manage.OrgDao;
import com.green.model.manage.Org;



/**
 * 人员
 * 
 */
@Repository("orgDao")
public class OrgDaoImpl extends BaseDaoImpl implements OrgDao {

	@Override
	public int insertOrg(Org ct) {
		return insert("com.green.dao.manage.OrgDao.insertOrg", ct);
	}

	@Override
	public int updateOrg(Org ct) {
		return update("com.green.dao.manage.OrgDao.updateOrg", ct);
	}

	@Override
	public int deleteOrg(Map<String, Object> param) {
		return delete("com.green.dao.manage.OrgDao.deleteOrg", param);
	}

	@Override
	public Org getOrgById(String id) {
		return (Org) super.getSqlSession().selectOne("com.green.dao.manage.OrgDao.getOrgById",id);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Org> getOrgList(Map<String, Object> param) {
		return (List<Org>) this.selectList("com.green.dao.manage.OrgDao.getOrgList", param);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Org> getChildOrg(String parentId) {
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("parentId", parentId);
		return (List<Org>) this.selectList("com.green.dao.manage.OrgDao.getOrgList", param);
	}
	
	
}
